package com.hyperzsoft.utils;

import java.text.DateFormatSymbols;
import java.util.Locale;

/**
 * Class to return Month Name from a month numeric
 * Allows for retrieving either Short or Long name
 * Allows for the setting of the Locale
 */
public class DateNames {
	String[] months = new DateFormatSymbols().getMonths();
	String[] shortMonths = new DateFormatSymbols().getShortMonths();
	String[] weekdays = new DateFormatSymbols().getWeekdays();
	String[] shortWeekdays = new DateFormatSymbols().getShortWeekdays();
	
	public String getMonthName(int monthToGet) {
		return months[monthToGet];
	}
	
	public String getMonthName(int monthToGet, boolean shortName) {
		return (shortName) ? shortMonths[monthToGet] : months[monthToGet];
	}
	
	public String getMonthName(int monthToGet, boolean shortName, Locale locale) {
		months = new DateFormatSymbols(locale).getMonths();
		shortMonths = new DateFormatSymbols(locale).getShortMonths();
		
		return (shortName) ? shortMonths[monthToGet] : months[monthToGet];
	}
	
	/**
	 * @param weekdayToGet expected to be zero based
	 * @return full string name of weekday i.e. Sunday
	 */
	public String getWeekdayName(int weekdayToGet) {
		return weekdays[weekdayToGet];
	}
	
	/**
	 * @param weekdayToGet expected to be zero based
	 * @param shortName boolean indicating to retrieve short name i.e. Sun
	 * @return returns the short string name of the weekday
	 */
	public String getWeekdayName(int weekdayToGet, boolean shortName) {
		return (shortName) ? shortWeekdays[weekdayToGet] : weekdays[weekdayToGet];
	}
	
	public String getWeekdayName(int weekdayToGet, boolean shortName, Locale locale) {
		weekdays = new DateFormatSymbols(locale).getWeekdays();
		shortWeekdays = new DateFormatSymbols(locale).getShortWeekdays();
		
		return (shortName) ? shortWeekdays[weekdayToGet] : weekdays[weekdayToGet];
	}
}
